#ifndef _INPUT_H_
#define _INPUT_H_
 
#include "OISEvents.h"
#include "OISInputManager.h"
#include "OISMouse.h"
#include "OISKeyboard.h"
#include "OISJoyStick.h"


// Forward declarations
class StateManager;
class GameWidget;
 
/**
 * @brief The InputHandler class
 *
 * Connects to Ogre's Object Oriented Input System
 */
class InputHandler : 
        public OIS::MouseListener, 
        public OIS::KeyListener, 
        public OIS::JoyStickListener
{
private:
    OIS::InputManager *m_ois;
    OIS::Mouse *mMouse;
    OIS::Keyboard *mKeyboard;
	unsigned long m_hWnd;
	GameWidget* m_GameWidget;
    StateManager *m_StateManager;    

	bool m_Capture;
	bool m_RequestCaptureStop;

	int m_Width;
	int m_Height;
public:
	InputHandler(GameWidget *p_GameWidget, StateManager *p_StateManager, unsigned long hWnd);
    ~InputHandler();
 
	void setWindowExtents(int p_Width, int p_Height) ;
    void capture();
	bool isCapturing() { return m_Capture; }
 
    // MouseListener
    bool mouseMoved(const OIS::MouseEvent &evt);
    bool mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID);
    bool mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID);
 
    // KeyListener
    bool keyPressed(const OIS::KeyEvent &evt);
    bool keyReleased(const OIS::KeyEvent &evt);
 
    // JoyStickListener
    bool buttonPressed(const OIS::JoyStickEvent &evt, int index);
    bool buttonReleased(const OIS::JoyStickEvent &evt, int index);
    bool axisMoved(const OIS::JoyStickEvent &evt, int index);
    bool povMoved(const OIS::JoyStickEvent &evt, int index);

	void StartCapture();
	void StopCapture();
};


#endif
